<template>
	<div class="app">
		<myNavbar :title="name + '专区'"></myNavbar>
		<scroller>
			<div class="specialArea">
				<div class="mg-T20 specialArea-list pd-L20 pd-R20">
					<div class="" v-for="item in specialAreaList"><productColumn :product="item" /></div>
				</div>
			</div>
			<loading class="loading" @loading="onloading" :display="loadinging ? 'show' : 'hide'">
				<text class="indicator-text">Loading ...</text>
				<loading-indicator class="indicator"></loading-indicator>
			</loading>
		</scroller>
	</div>
</template>
<script>
import { list } from '../../../api/product';
import productColumn from '../../../components/product/column.vue';
import myNavbar from '../../../components/myNavbar/myNavbar.vue'
export default {
	name: '',
	components: {
		myNavbar,
		productColumn
	},
	filters: {}, // 过滤器
	data() {
		return {
			name: '',
			tagIds: [],
			specialAreaList: [],
			loadinging: false,
			pageNum: 1,
			pageSize: 10,
		};
	},
	created() {
		console.info('福利卡的id--' + JSON.stringify(app.config.params));
		let params = app.config.params
		this.tagIds = params.tagIds
		this.name = params.name
		this.getspecialAreaData();
	},
	methods: {
		getspecialAreaData() {
			this.loadinging = true;
			let params = {
				pageNum: this.pageNum,
				pageSize: this.pageSize,
				tagIds: this.tagIds
			};
			list(params).then(res => {
				console.log('接收收藏夹信息--' + JSON.stringify(res));
				if (res.type == 'success') {
					res.data.data.forEach(item => {
						this.specialAreaList.push(item)
					})
					eeui.loadingClose();
					this.loadinging = false;
				}
			}).catch(() => { this.loadinging = false; });
		},
		// 触底加载
		onloading() {
			if (this.loadinging == false) {
				this.pageNum += 1;
				// modal.toast({ message: '加载中', duration: 1 });
				eeui.loading();
				this.getspecialAreaData();
			}
		},
	}
};
</script>

<style scoped>
.specialArea-list {
	/* margin-top: 20px; */
	padding: 0 20px;
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	justify-content: space-between;
}
.loading {
	width: 750px;
	display: -ms-flex;
	display: -webkit-flex;
	display: flex;
	-ms-flex-align: center;
	-webkit-align-items: center;
	-webkit-box-align: center;
	align-items: center;
}
.indicator {
	margin-top: 16px;
	height: 40px;
	width: 40px;
	color: blue;
}
</style>
